﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Dir
{

    public static float getDirectionVar(Direction direction, float offset)
    {
        if (direction == Direction.LEFT)
            return -offset;
        else if (direction == Direction.RIGHT)
            return offset;
        return -1.0f;
    }

    public static Vector2 directionSwitchVector2(Direction d)
    {
        if (d == Direction.LEFT)
            return Vector2.left;
        else if (d == Direction.RIGHT)
            return Vector2.right;
        return Vector2.zero;
    }

    public static float getDirectionToXPos(float x1, float x2)
    {
        if (x1 <= x2)
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }

    public static Direction numToDirection(float v)
    {
        if (v == 0)
            return Direction.LEFT;
        else if (v == 1)
            return Direction.RIGHT;
        return Direction.ERROR;
    }

    public static float directionToNum(Direction d)
    {
        if (d == Direction.LEFT)
            return 0.0f;
        else
            return 1.0f;

        return -1.0f;
    }

}